﻿using Kingdee.BOS;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System.ComponentModel;

namespace Caraya.MFG.BusinessPlugIn
{
    /// <summary>
    /// 【表单插件】打开本地电脑上的exe程序
    /// </summary>
    [Description("[表单插件]打开本地电脑上的exe程序"), HotUpdate]
    public class StartupExeFormPlugIn : AbstractDynamicFormPlugIn
    {
        public override void ButtonClick(ButtonClickEventArgs e)
        {
            base.ButtonClick(e);
            var linkBtnKey = "F_CARA_Link";
            if (e.Key.EqualsIgnoreCase(linkBtnKey))
            {
                if (Context.ClientType != ClientType.Silverlight && Context.ClientType != ClientType.WPF)
                {
                    return;
                }
                var url = @"C:\Program Files (x86)\caraya\暂存的生成入库单欠料计算\暂存的生产入库单欠料计算.exe";
                this.View.GetControl(linkBtnKey).InvokeControlMethod("SetClickFromServer", url);
            }
        }
    }
}
